package com.shenmazong.servereduuser.controller;

import com.shenmazong.servereduuser.entity.TbStaffPosition;
import com.shenmazong.servereduuser.service.TbStaffPositionService;
import com.shenmazong.utils.ResultResponse;
import com.shenmazong.vo.BatchChooseIdVo;
import com.shenmazong.vo.ListParamVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author GuanJiaHe
 * @version 1.0
 * @description TODO
 * @date 2021/9/23 8:17
 */
@Api(tags = {"职工岗位API接口"})
@RestController
@Slf4j
@RequestMapping(value = "/staffPosition")
public class TbStaffPositionController {
    @Autowired
    private TbStaffPositionService staffPositionService;

    @ApiOperation(value="增加职工岗位", notes="增加职工岗位", produces="application/json")
    @PostMapping("createStaffPosition")
    public ResultResponse createStaffPosition(@RequestBody TbStaffPosition staffPosition){
        return staffPositionService.createStaffPosition(staffPosition);
    }

    @ApiOperation(value="删除职工岗位", notes="删除职工岗位", produces="application/json")
    @DeleteMapping("deleteStaffPositon")
    public ResultResponse deleteStaffPositon(@RequestBody BatchChooseIdVo idVo){
        return staffPositionService.deleteStaffPositon(idVo);
    }

    @ApiOperation(value="获取全部职工岗位", notes="获取全部职工岗位", produces="application/json")
    @PostMapping("getAllStaffPosition")
    public ResultResponse getAllStaffPosition(@RequestBody ListParamVo paramVo){
        return staffPositionService.getAllStaffPosition(paramVo);
    }

    @ApiOperation(value="更新职工岗位", notes="更新职工岗位", produces="application/json")
    @PostMapping("updateStaffPosition")
    public ResultResponse updateStaffPosition(@RequestBody TbStaffPosition staffPosition){
        return staffPositionService.updateStaffPosition(staffPosition);
    }
}
